Ext.define('Triends.view.UserinfoModify', {
	extend: 'Ext.Panel',
	xtype: 'infomodify',
	id: 'infomodify',
	config: {
		fullscreen: true,
		scrollable: true,
		padding: 20,
    	items: [
    	{
    		xtype: 'fieldset',
	    	items: [
        	{
    			xtype: 'textfield',
	    		id : 'usercacao',
    	        label: "카카오톡 ID",
    	        labelAlign: 'top',
    	        maxLength: 30
        	},
	    	{
	    		xtype: 'textareafield',
	    		id: 'userintroduction',
	    		label: 'Introduction',
	    		maxRows: 20,
	    		maxLength: 260,
	    		height: 330,
	    		labelAlign: 'top'
	    	}]
    	},
    	{
			xtype: 'button',
			text: 'Modify',
			width: '100%',
			handler: function(){
				var UserStore = Ext.getStore('UserStore');
				var userid = UserStore.getAt(0).data.ID;
				
				var usercacao = Ext.getCmp('usercacao').getValue();
				var userintroduction = Ext.getCmp('userintroduction').getValue();
 				
 				Ext.data.JsonP.request({
   					url: 'http://itscreater.cafe24.com/Triends/UserinfoModify.jsp',
   					params: {
   						id: userid, //localStorage.ID
   						cacao:usercacao,
   						introduction: userintroduction
   					},
          			callbackKey: 'callback',
          			success: function(result) {
         				var UserStore = Ext.getStore('UserStore');
         				UserStore.getProxy().setExtraParams({id: userid});
            			UserStore.load({
            				callback: function() {
            					Triends.app.getHistory().add(Ext.create('Ext.app.Action', {
            						url: 'mainpage'
        						}));
            				}
            			});
           			}
     	 		});
			}
    	}]
	}
});